<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<!--js-ajax-form-->
		<form method="post" class="form-horizontal  margin-top-20" action="{:url('user/registPost')}">
			<div class="form-group">
					<label for="input-user_login" class="col-sm-2 control-label"><span class="form-required">*</span>企业名称</label>
					<div class="col-md-6 col-sm-10">
						<input type="text" class="form-control" name="accName" value="" />
					</div>
				</div>
			<div class="form-group">
				<label for="input-parent_id" class="col-sm-2 control-label"><span class="form-required">*</span>部门名称</label>
				<div class="col-md-6 col-sm-10">
					<select class="form-control" name="depart_id" id="input-depart_id" 
					 onchange="searchStation()">
						<option value="0">作为一级菜单</option>{$select_category}
					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="input-stationID" class="col-sm-2 control-label"><span class="form-required">*</span>岗位名称</label>
				<div class="col-md-6 col-sm-10">
					<select class="form-control" name="stationID" id="select_station"
					       >
					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="input-user_login" class="col-sm-2 control-label"><span class="form-required">*</span>用户编码</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-user_login" name="user_login">
				</div>
			</div>
			<div class="form-group">
				<label for="input-user_nickname" class="col-sm-2 control-label"><span class="form-required">*</span>{:lang('USERNAME')}</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-user_nickname" name="user_nickname">
				</div>
			</div>
			<div class="form-group">
				<label for="input-user_pass" class="col-sm-2 control-label"><span class="form-required">*</span>{:lang('PASSWORD')}</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-user_pass" name="user_pass" placeholder="******">
				</div>
			</div>
			<div class="form-group">
				<label for="input-user_mobile" class="col-sm-2 control-label"><span class="form-required">*</span>手机号</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-user_mobile" name="mobile">
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
				</div>
			</div>
		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
	<script type="text/javascript">
		/*组织机构下拉框选择事件*/
		function searchStation() {
	      //获取组织机构select 对象
	       var selectDepartment = document.getElementById('input-depart_id');  
	       //拿到选中项的索引：
	       var index=selectDepartment.selectedIndex;
	       //拿到选中项options的value：
	       var departmentValue = selectDepartment.options[index].value;
	  
	       //拿到选中项options的text：
	       //var departmentStr = (selectDepartment.options[index].text);
	       var departmentText = selectDepartment.options[index].text;
		   
	       $.ajax({
	            url:"/index.php/admin/user/ajaxStation",
	            data:{stationStr:departmentValue},
	            type:"get",
	            dataType:"json",
	            success: function(data){
	                $("#select_station").find("option").remove();
	                // $("#select_station").append("<option value=''>请选择</option>");
	                //动态给select 赋值
	                for(var i=0;i<data.length;i++){
	                   $("#select_station").append("<option id = '"+ data[i]["stationID"]+"' value='"+ data[i]["stationID"]+"'>"+ data[i]["stationName"]+"</option>");
	                } 
	            }
	        });
	    }
	</script>
</body>
</html>